<?
include_once("../include/session.php");
include_once("../include/dbConnect.php");
if(ereg("userMenu.php",$_SERVER['PHP_SELF'])|$_SESSION["username"]=="") exit();
?>
<link href="../style/common.css" rel="stylesheet" type="text/css">

<table width="100%" border="0" cellpadding="2" cellspacing="2">
  <tr bgcolor="#333399"> 
    <td width="18%" height="19" nowrap class="fieldTable" onMouseOver="this.style.backgroundColor='#FF9900'" onMouseOut="this.style.backgroundColor='#333399'"><font color="#FFFFFF">:: 
      <a href="../home/vUpdateUser.php" class="home">Update user data</a></font></td>
    <?
		
	    $jumlah=count(split(";",$_SESSION["akses"]));
		$sql="SELECT * FROM users WHERE username='".$_SESSION["username"]."' and active='yes' ";
		$query_sql=mysql_query($sql);
		if(mysql_num_rows($query_sql)){
			$userdata=mysql_fetch_array($query_sql);
			$access=$userdata["access"];
			$sql="SELECT * FROM access WHERE active='yes' ORDER BY accessid ASC";
			$query_sql=mysql_query($sql);
			$i=1;
			$limit=($jumlah>5?5:$jumlah);
			while($accesspage=mysql_fetch_array($query_sql)){
				if(ereg($accesspage["accessid"],$_SESSION["akses"])){
					if($i==$limit){
						echo "</tr><tr>";
						$i=0;
					}
					$i++;
					echo "<td  nowrap bgcolor=\"#333399\" class=\"fieldTable\" width=\"".round(100/$limit)."%\" onMouseOver=\"this.style.backgroundColor='#FF9900'\" onMouseOut=\"this.style.backgroundColor='#333399'\"><font color=\"#FFFFFF\">:: <a href=\"".$accesspage["page"]."\" class=\"home\" >".ucfirst($accesspage["accessid"])."</a></font></td>\n";
					
				}
			}
			if($i==$limit){
						echo "</tr><tr>";
						$i=0;
			}
		}
		?>
		
    <td width="<? echo round(100/$limit) ?>%" nowrap bgcolor="333399" class="fieldTable" onMouseOver="this.style.backgroundColor='#FF9900'" onMouseOut="this.style.backgroundColor='#333399'"><font color="#FFFFFF">:: 
      <a href="../home/vLogin.php?id=<? echo base64_encode(session_id().$_SERVER['PHP_SELF'].$_SESSION["username"]) ?>=&logout=true" class="home" >Logout</a></font></td>
  </tr>
</table>